<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});
//基础路由
Route::get('abc', function () {
    return "hello ";
});

Route::post('abc2',function (){
   return "hi";
});
//多请求路由
Route::match(['get','post'],'multy1',function (){
   return 'multy1';
});
//Route::any('multy2',function (){
//    return 'multy2';
//});

//路由参数
//Route::get('user/{id}',function ($id){
//    return 'user-'.$id;
//});
//可选的
//Route::get('user/{name?}',function ($name = null){
//    return 'user-1'.$name;
//});
//Route::get('user/{name?}',function ($name='aa'){
//    return 'user-name'.$name;
//});

//Route::get('user/{name?}',function ($name = 'sean'){
//    return 'user-name-'.$name;
//})->where('name','[A-Za-z]+');
//正则
//Route::get('user/{id}/{name?}',function ($id,$name = 'sean'){
//    return 'user-id-'.$id.'user-name-'.$name;
//})->where(['id'=>'[0-9]+','name'=>'[A-Za-z]+']);

// 路由别名
//Route::get('user/center',['as'=>'center',function(){
//    return route('center');
//}]);

// 路由群组

Route::group(['prefix'=>'member'],function (){
    Route::get('user/center',['as'=>'center',function(){
        return route('center');
    }]);
    Route::any('multy2',function (){
   return 'member-multy2';
});
});


//Route::get('member/info','MemberController@info');

//Route::get('member/info',[
//    'uses'=>'MemberController@info',
//    'as'=>'memberinfo'
//]);
Route::any('member/{id}','MemberController@info')
    ->where('id','[0-9]+');

//Route::any('member/{id}','MemberController@info')
//->where(['id'=>'[0-9]+']);

